<!-- 特别修正结算送审页面 -->
<template>
    <div>
        <el-header height="36px">
            <header-title :title="title" />
        </el-header>
        <component v-if="prjDetail.prjType" :is="page" v-for="page in pageSetting" :key="page" :ref="page"
            :prj-stage="'AM'" :prj-type="prjDetail.prjType" :prj-id="String(prjDetail.prjId)"
            :getBasicDetail="getBasicDetail" :spaclTag="true"/>
        <div style="display: flex;justify-content: center;margin-bottom: 15px;">
            <el-button v-if="showBtn" class="pms-button-primary" @click="projectSendReview">项目送审</el-button>
            <el-button class="pms-button-primary" @click="close">关闭</el-button>
        </div>
    </div>
</template>

<script>
import {
    getPrjDetailApi
} from "@/api/speciaCorrection/index"
import HeaderTitle from '@/components/basic/HeaderTitle'
import JnPrjDetail from '@/components/jn/JnPrjDetail.vue'
import ZrAttachmetl from '@/components/zr/ZrAttachmetl.vue'
import OrderInfo from "./orderInfo/orderInfo.vue"
import { clonePage } from '@/utils'
import {
    getSpecialDetail,
    submitSpecialApi
} from "@/api/speciaCorrection/index";
export default {
    name: "SettlementSendReview",
    components: {
        HeaderTitle,
        JnPrjDetail,
        ZrAttachmetl,
        OrderInfo
    },
    data() {
        return {
            title: "",
            pageSetting: ['JnPrjDetail', 'OrderInfo', 'ZrAttachmetl'],
            prjDetail: {},
            getBasicDetail: {}
        }
    },
    computed: {
        showBtn() {
            return ['0', '1'].includes(this.getBasicDetail.isPushAudit)
        },
    },
    created() {
        this.getPrjDetail(this.$route.query.prjId)
        this.getSpecialInfo()
    },
    methods: {
        // 获取基本信息
        async getPrjDetail(prjId) {
            const { code, data } = await getPrjDetailApi({ prjId: prjId })
            if (+code === 200) {
                this.prjDetail = data
                this.title = this.prjDetail.prjName
            }
        },
        async getSpecialInfo() {
            const params = {
                prjId: "",
                adjustId: this.$route.query.adjustId,
            };
            const { code, data } = await getSpecialDetail(params);
            if (+code === 200) {
                this.getBasicDetail = data
            }
        },
        async projectSendReview() {
            const params = {
                prjId: this.$route.query.prjId,
                bizseq: this.$route.query.adjustId,
            }
            const { code } = await submitSpecialApi(params)
            if (+code === 200) {
                this.$alert(`项目送审成功`, '系统提示', {
                    confirmButtonText: '确定',
                    dangerouslyUseHTMLString: true,
                    cancelButtonClass: 'pms-zr-button',
                    confirmButtonClass: 'pms-zr-button-primary',
                    callback: action => {
                        this.close()
                    }
                })
            }
        },
        close() {
            clonePage()
        }
    }
}

</script>
<style lang="scss" scoped></style>